package com.qiyuexinxi.chat.feign;

import com.qiyuexinxi.chat.common.GenericResponse;
import com.qiyuexinxi.chat.constants.BaseResultCode;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.Map;

/**
 * @author yangxingyu
 * @date 2020/2/27
 * @description
 */
@Component
public class SendMessageBack implements  FallbackFactory<SendMessageFeign> {

    @Override
    public SendMessageFeign create(Throwable throwable) {
        return new SendMessageFeign() {
            @Override
            public Map<String, Object> sendPhoneCodeGet(Integer uid, String password, String mobile, String msg) {
                return null;
            }

            @Override
            public Map<String, Object> sendPhoneCode(Map<String, Object> params) {
                return null;
            }
        };
    }

    private GenericResponse getErrorResponse() {
        GenericResponse response = new GenericResponse();
        response.setCode(BaseResultCode.UNKOWN_ERROR);
        response.setMessage("服务调用熔断");
        return response;
    }
}
